<template>
  <el-dialog :title="$tt('label_tms_vehicle_map_viewer')" :visible.sync="visible" custom-class="dialog_big"
    destroy-on-close>
    <div v-loading="loading">
      <MapContainer ref="aMapRef" style="height:500px" />
    </div>
    <span slot="footer" class="dialog_footer">
      <el-button @click="visible = false">{{ $tt('label_close') }}</el-button>
    </span>
  </el-dialog>
</template>

<script>

import MapContainer from '@/component/common/MapContainer.vue'
export default {
  components: { MapContainer },
  data() {
    return {
      visible: false,
      loading: false,

    }
  },
  methods: {
    show(rows) {
      this.visible = true
      const lnglats = []
      rows.forEach(item => {
        lnglats.push({ lnglats: [item.longitude, item.latitude], addressDetail: item.addressDetail })
      })
      setTimeout(() => {
        this.$refs.aMapRef.setMarkers(lnglats)
      }, 1000);
    }
  }
}
</script>
